INCLUDE_DIR = ../include
OBJECT_DIR = ../bin
LIBRARY_DIR = ../lib
BUILD_DIR = ../build



BOOST_INCLUDE = $(LIBRARY_DIR)/boost_1_55_0/

BOOST_INCLUDE_REGEX = $(BOOST_INCLUDE)boost/regex/



CC = g++
CFLAGS = -I$(INCLUDE_DIR) -I$(BOOST_INCLUDE) -L$(LIBRARY_DIR)

LIBS = -lboost_regex

DEPS = $(patsubst %,$(INCLUDE_DIR)/%,$(_DEPS))

_OBJ = ChatClient.o main.o
OBJ = $(patsubst %,$(OBJECT_DIR)/%,$(_OBJ))

$(OBJECT_DIR)/%.o: %.cpp $(DEPS)
	$(CC) -c -o $@ $< $(CFLAGS) 

boost_regex:
	make -C $(BOOST_INCLUDE)libs/regex/build -f gcc.mak install
	cp $(BOOST_INCLUDE)libs/regex/build/gcc/libboost_regex-gcc-1_53.a $(LIBRARY_DIR)/libboost_regex.a

udpchat: $(OBJ)
	$(CC) -o $(BUILD_DIR)/$@ $^ $(CFLAGS) $(LIBS)

.PHONY: clean

clean:
	rm -f $(OBJECT_DIR)/*.o *~ core $(INCLUDE_DIR)/*~

install: all

all: boost_regex udpchat 
